<template>
	<view class="m-textarea-c">
		<textarea class="textarea" :placeholder="placeholder" :disabled="disabled" placeholder-class="placeholder"
			:value="value" :maxlength="maxlength" :cursor-spacing="80" :focus="focus" :auto-height='autoHeight'
			:confirm-type="confirmType" @input="input"></textarea>
	</view>
</template>

<script>
	export default {
		name: "m-textarea",
		props: {
			value: {
				type: String | Number,
				default: "",
			},
			placeholder: {
				type: String,
				default: "请输入",
			},
			disabled: {
				type: Boolean,
				default: false,
			},
			focus: {
				type: Boolean,
				default: false,
			},
			maxlength: {
				type: Number,
				default: -1,
			},
			confirmType: {
				type: String,
				default: "done",
			},
			autoHeight: {
				type: Boolean,
				default: true,
			},
		},
		methods: {
			input({
				detail: {
					value
				}
			}) {
				this.$emit("input", value);
			},
		},
	};
</script>

<style lang="scss" scoped>
	.m-textarea-c {
		flex: 1;
		min-height: 100rpx;

		.placeholder {
			font-size: 26rpx;
			font-family: PingFang SC;
			font-weight: 400;
			color: #999999;
		}

		.textarea {
			width: 100%;
			min-height: 100rpx;
			font-size: 26rpx;
			font-family: PingFang SC;
			font-weight: 400;
			color: #333;
			min-height: 200rpx;
			padding: 20rpx 0;
			line-height: 34rpx;
		}
	}
</style>
